<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>数组的变化侦听</h2>
      <button v-on:click="fn">btn</button>
      <ul>
        <li v-for="(item, index) in list" :key="index">{{ item }}</li>
      </ul>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      // 整理所有的数组方法
      // 备注是否改变原数组，返回值
      // es6.ruanyifeng.com 解构
      Vue.createApp({
        data() {
          return {
            list: [3, 4, 5],
          };
        },
        methods: {
          fn() {
            this.list.push(6);
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
